<template>
  <div class="index.vue">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>PID设置</span>
        <!-- <el-button style="float: right; padding: 3px 0;" type="text"
          >操作按钮</el-button
        > -->
      </div>

      <el-table :data="banglist" style="width: 100%;">
        <el-table-column prop="id" label="ID"> </el-table-column>
        <el-table-column prop="session" label="媒体"> </el-table-column>
        <el-table-column prop="parentId" label="PID"> </el-table-column>
        <el-table-column prop="desc" label="备注"> </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" @click="adddesc(scope.row)"
              >设置备注</el-button
            >
            <!-- <el-button type="warning" size="mini" @click="delList(scope.row)"
              >删除</el-button
            > -->
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getPid, addDesc } from "@/api/index";
export default {
  name: "index.vue",
  data() {
    return {
      banglist: [],
      desc: "",
    };
  },

  computed: {},
  created() {
    this.getPid();
  },
  mounted() {},
  methods: {
    adddesc(row) {
      var that = this;
      this.$prompt("请输入PID备注", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(({ value }) => {
          console.log(value);
          addDesc({
            pid_id: row.id,
            desc: value,
          }).then((res) => {
            console.log(res);
            that.getPid();
          });
        })
        .catch(() => {});
    },
    getPid() {
      getPid({ user_id: localStorage.getItem("userid") })
        .then((res) => {
          //   console.log("getpid", res);
          this.banglist = res.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style lang="less" scoped></style>
